package com.example.flight.config;

import com.example.flight.common.AdminInterceptor;
import com.example.flight.common.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/*@Configuration*/
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserInterceptor())
                .addPathPatterns("/orders/**");
        registry.addInterceptor(new AdminInterceptor())
                .addPathPatterns("/admin/{aid}")
                .addPathPatterns("/users/{uid}")
                .addPathPatterns("/users")
                .addPathPatterns("/flights/**")
                .excludePathPatterns("/admin/login")
                .excludePathPatterns("/flights");

    }
}
